package com.micromsg.basic.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class IndexController {
    // 127.0.0.1:9001/index
    // 127.0.0.1:9001/hello

    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public String index(Model model) {
        return "index";
    }

    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String hello(Model model) {
        model.addAttribute("message", "Hello, Spring Boot with FreeMarker!");
        return "hello"; // 这里返回的是模板的名称，Spring Boot将根据该名称查找模板文件
    }
}
